/*
 * hal_current_sensor.h
 *
 *  Created on: 2025 Apr 9
 *      Author: SFLY
 */

#ifndef XTFOCLIB_HAL_DRIVERS_HAL_CURRENT_SENSOR_H_
#define XTFOCLIB_HAL_DRIVERS_HAL_CURRENT_SENSOR_H_

#include "bsp_board_config.h"

typedef struct{
uint8_t CurrentSensorRdy;//上电是否完成静态电流采样计数
float OffsetDetectCnt;//上电记录静态电流计数器
float OffsetDetectTime;//上电记录静态电流总时间
float IuOffset;//U相电流静态偏差
float IvOffset;//V相电流静态偏差
float IwOffset;//W相电流静态偏差
float IuvwGain;//电流采样转换系数
float VbusGain;//母线电压采样转换系数
float IuObser;//U相电流观测值
float IvObser;//V相电流观测值
float IwObser;//W相电流观测值
float StdVbusObser;//归一化母线电压观测值
float RVbusObser;//真实母线电压观测值，用于过压检测
uint32_t ErrorFlag;//电流传感器错误标志
void (*current_sensor_checkoffset)(void* );
void (*current_sensor_update)(void*);
}xt_hal_current_sensor_t;

void Hal_Current_Sensor_Init(xt_hal_current_sensor_t* sensor);
void Hal_Current_Sensor_Update(void* sensor_void_ptr);
void Hal_Current_Sensor_CheckOffset(void* sensor_void_ptr);

#endif /* XTFOCLIB_HAL_DRIVERS_HAL_CURRENT_SENSOR_H_ */
